package com.example.beautymakeup.dao;


import com.example.beautymakeup.pojo.Comment;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentDao {
    @Select("select c.*,user.userName,user.userImage from `comment` c,user where user.uid = c.userId and shopId = #{shopId} order by date desc;")
    List<Comment> getByShopId(int shopId);

    @Select("select count(*) from `comment` where shopId = #{shopId};")
    int getByShopIdCount();

    @Insert("insert into `comment` (shopId,userId,date,score,orderId,comment,image) values (#{shopId},#{userId},#{date},#{score},#{orderId},#{comment},#{image});")
    int add(Comment comment);


}
